// TOWN SCRIPT
//    Town 11: Abandoned Mine
//      - connected to t10 Mine Tunnels

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documentation. States you write
// yourself should be numbered from 10-100.

// flags:
// 11, 0 = entry message flag
// 11, 1 = chest untrapped flag
// 11, 2 = tripped detection by bad guys flag
// 11, 3 = encampment message flag

begintownscript;

variables;

short choice;

body;

beginstate INIT_STATE;
	turn_off_training(TRUE);
	set_crime_tolerance(1);
	add_range_to_group(6, 17, 2); // group 1002
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
	if (get_flag(11, 0) == FALSE) {
		set_flag(11, 0, TRUE);
		reset_dialog();
		add_dialog_str(0, "Judging from the condition of this mine, it looks like it played out long ago.", 0);
		add_dialog_str(1, "It does appear to have had recent visitation though.", 0);
		add_dialog_str(2, "Perhaps even something that will help complete your quest.", 0);
		add_dialog_choice(0, "Ok");
		choice = run_dialog(TRUE);
	}
break;

beginstate 10;
	block_entry(TRUE);
	move_to_new_town(10, 4, 59);
break;

beginstate 11;
	if ((get_flag(50, 1) == FALSE) && (get_flag(11, 2) == FALSE)) {
		set_flag(11, 2, TRUE);
		reset_dialog();
		add_dialog_str(0, "You hear a murmur of voices coming from the passage to the right.", 0);
		add_dialog_str(1, "Just as you peer around the corner to see what's what, you are spotted!", 0);
		add_dialog_str(2, "A sudden hush, followed by sounds of preparation greet you from down the passage.", 0);
		add_dialog_str(3, "Oh Oh!", 0);
		add_dialog_choice(0, "Ok");
		choice = run_dialog(FALSE);
		activate_hidden_group(1);
		alert_char(1002);
	}
break;

beginstate 12;
	if (get_flag(11, 3) == FALSE) {
		set_flag(11, 3, TRUE);
		if (get_flag(50, 1) == FALSE) {
			message_dialog("The encampment is dirty and smelly.", "There doesn't appear to be much of value here.");
		}
		else {
			message_dialog("The encampment looks like it was hastily abandoned.", "Doesn't look like much was left behind.");
		}
	}
break;
